<!doctype html>
[#escape x as (x)!?html]
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>${info.title} - ${site.fullNameOrName}${global.customs['poweredBy']}</title>
    <meta name="keywords" content="${info.keywords}">
    <meta name="description" content="${info.description}">
    [#include 'inc_meta.html'/]
    [#include 'inc_css.html'/]
    [#include 'inc_js.html'/]
    <link rel="stylesheet" href="_files/vendor/photoswipe/dist/photoswipe.css">
    <link rel="stylesheet" href="_files/vendor/photoswipe/dist/default-skin/default-skin.css">
    <script src="_files/vendor/photoswipe/dist/photoswipe.min.js"></script>
    <script src="_files/vendor/photoswipe/dist/photoswipe-ui-default.min.js"></script>
</head>
<body>
[#include 'inc_header.html'/]
<div class="container">
    <nav class="row" aria-label="breadcrumb">
        <ol class="breadcrumb col">
            [#list node.hierarchy as n]<li class="breadcrumb-item"><a href="${n.url}">${n.name}</a></li>[/#list]
        </ol>
    </nav>
</div>
<div class="container">
    <div class="row">
        <div class="col-lg-8 mt-2">
            <h3 class="cm-ff-yh">${info.title}</h3>
            <div class="mt-3 pb-1 border-bottom text-muted">
                <span>${info.publishDate?string('yyyy-MM-dd HH:mm')}</span>
                [#if info.sourceUrl??]
                <span class="ml-2"><a href="${info.sourceUrl}" target="_blank" class="text-reset">${info.source}</a></span>
                [#else]
                <span class="ml-2">${info.source}</span>
                [/#if]
                <span class="ml-2">${info.author!info.creator.realName!info.creator.username}</span>
                <i class="ml-2 far fa-eye"></i> <span id="info_views"></span>
                <script>$("#info_views").load("${ctx}/info_views/${info.id}?d=" + new Date() * 1);</script>
                <script src="${dy}/app?template=info_favorites&id=${info.id}"></script>
            </div>
            <div class="mt-3" id="infoText">[#noescape]${info.textWithoutPageBreak!}[/#noescape]</div>
            <div class="lead d-flex justify-content-center text-info">
                <div class="cm-pointer" onclick="voteUp()"><i class="far fa-thumbs-up"></i> <span id="ups"></span></div>
                <div class="cm-pointer ml-4" onclick="voteDown()"><i class="far fa-thumbs-down"></i> <span id="downs"></span></div>
            </div>
            <script>
                function voteUp() {
                    $.post('${dy}/info_digg',{id:${info.id}},function(data){
                        if(data!=='0'){$('#ups').text(data);}else{alert("你已经顶过一次！")}
                    });
                }
                function voteDown() {
                    $.post('${dy}/info_bury',{id:${info.id}},function(data){
                        if(data!=='0'){$('#downs').text(data);}else{alert("你已经踩过一次！")}
                    });
                }
                $.get('${dy}/info_diggs/${info.id}?d='+new Date()*1,function(data) {
                    $('#ups').text(data[0]);$('#downs').text(data[1]);
                },"json");
            </script>
            <div class="bdsharebuttonbox mt-2"><a href="#" class="bds_more a-none" data-cmd="more">分享到：</a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><!--<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a>--><a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a></div>
            <script>
                window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};
                with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
            </script>
            <ul class="mt-3 list-unstyled">
                [@InfoPrev id=info.id;bean]
                    [#if bean??]
                    <li class="text-truncate"><strong>上一条：</strong><a href="${bean.url}" class="text-reset">${bean.title}</a></li>
                    [#else]
                    <li class="text-truncate"><strong>上一条：</strong>没有了</li>
                    [/#if]
                [/@InfoPrev]
                [@InfoNext id=info.id;bean]
                    [#if bean??]
                    <li class="text-truncate"><strong>下一条：</strong><a href="${bean.url}" class="text-reset">${bean.title}</a></li>
                    [#else]
                    <li class="text-truncate"><strong>下一条：</strong>没有了</li>
                    [/#if]
                [/@InfoNext ]
            </ul>
            <h6 class="border-bottom mt-2"><span class="border-primary cm-block-head-bottom">相关新闻</span></h6>
            [@InfoFulltextList q=info.title excludeId=info.id limit=5;list]
            <ul class="list-unstyled cm-list-round">
                [#list list as fulltextInfo]
                <li class="text-truncate">[@A bean=fulltextInfo class="a text-reset"/]</li>
                [/#list]
            </ul>
            [/@InfoFulltextList]
            <!--<div id="commentDiv" class="mt-3"></div>-->
            <!--<script>-->
                <!--$("#commentDiv").load("${dy}/comment_list?fid=${info.id}&url=${url?url}&d="+new Date()*1);-->
            <!--</script>-->
        </div>
        [#include 'inc_right.html'/]
    </div>
</div>

<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
    <!-- Background of PhotoSwipe. It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>
    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">
        <!-- Container that holds slides. PhotoSwipe keeps only 3 of them in the DOM to save memory. Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>
        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">
            <div class="pswp__top-bar">
                <!--  Controls are self-explanatory. Order can be changed. -->
                <div class="pswp__counter"></div>
                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
                <!--<button class="pswp__button pswp__button&#45;&#45;share" title="Share"></button>-->
                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
                <!-- Preloader demo https://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>
            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"></button>
            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"></button>
            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>
        </div>
    </div>
</div>

<script>
    var initPhotoSwipeFromDOM = function(gallerySelector) {
        var onClick = function(e) {
            e = e || window.event;
            e.preventDefault ? e.preventDefault() : e.returnValue = false;

            var eTarget = e.target || e.srcElement;
            var index = eTarget.getAttribute('data-index');
            if(index >= 0) {
                // open PhotoSwipe if valid index found
                openPhotoSwipe( parseInt(index, 10), gallerySelector );
            }
            return false;
        };

        var parseElements = function (el) {
            var numNodes = el.length,
                items = [],
                imgEl,
                item;

            for (var i = 0; i < numNodes; i++) {
                imgEl = el[i]; // <img> element
                // create slide object
                // 图片宽高未知，先设置为 0，下面有代码会重新获取图片宽高。
                item = {
                    src: imgEl.src,
                    w: 0,
                    h: 0
                };
                items.push(item);
            }
            return items;
        };

        var openPhotoSwipe = function (index, galleryElement, disableAnimation) {
            var pswpElement = document.querySelectorAll('.pswp')[0],
                options = {index: index},
                items = parseElements(document.querySelectorAll( gallerySelector )),
                gallery;
            if (disableAnimation) options.showAnimationDuration = 0;
            gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
            // 获取图片宽高 https://github.com/dimsemenov/PhotoSwipe/issues/796
            gallery.listen('gettingData', function (index, item) {
                if (item.w < 1 || item.h < 1) { // unknown size
                    var img = new Image();
                    img.onload = function () { // will get size after load
                        item.w = this.width; // set image width
                        item.h = this.height; // set image height
                        gallery.invalidateCurrItems(); // reinit Items
                        gallery.updateSize(true); // reinit Items
                    };
                    img.src = item.src; // let's download image
                }
            });
            gallery.init();
        };

        var galleryElements = document.querySelectorAll( gallerySelector );
        for(var i = 0, l = galleryElements.length; i < l; i++) {
            galleryElements[i].setAttribute('data-index', i);
            galleryElements[i].onclick = onClick;
            galleryElements[i].style.cursor= 'pointer';
        }
    };
    $('#infoText img').addClass('img-fluid');
    $('#infoText img').addClass('gallery-img');
    initPhotoSwipeFromDOM('.gallery-img');
</script>
[#include 'inc_footer.html'/]
</body>
</html>
[/#escape]